#include<iostream>
using namespace std;
int main()
{
	int n, a[1000], i = 0, b;
	cin >> n;
	b = n;
	while (n != 1)
	{
		if (n % 2 == 0)
		{
			n = n / 2;
			a[i] = n;

		}
		else
		{
			n = n * 3 + 1;
			a[i] = n;
		}
		i++;

	}
	a[i] = b;
	for (; i >= 0; i--)
	{

		cout << a[i] << " ";
	}

	system("pause");
	return 0;
}
